﻿using System;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.fn
{
    public partial class requestDescript : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Text.StringBuilder sbuf = new System.Text.StringBuilder();
            sbuf.AppendLine(string.Format("{0}_{1}", "Url", this.Request.Url.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "RawUrl", this.Request.RawUrl.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "Path", this.Request.Path.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "ApplicationPath", this.Request.ApplicationPath.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "PhysicalApplicationPath", this.Request.PhysicalApplicationPath.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "PhysicalPath", this.Request.PhysicalPath.ToString() + "<br>"));


            string[] accepts = Request.AcceptTypes;
            foreach (var acc in accepts)
            {
                sbuf.AppendLine("AcceptTypes-->" + acc + "<br>");
            }
            sbuf.AppendLine("<br>");

            string browse = Request.UserAgent;
            sbuf.AppendLine("UserAgent-->" + browse + "<br>");
            string browser = Request.Browser.Browser;
            sbuf.AppendLine("Browser-->" + browser + "<br>");

            string userhostname = Request.UserHostName;
            sbuf.AppendLine("UserHostName-->" + userhostname + "<br>");
            string userip = Request.UserHostAddress;
            sbuf.AppendLine("UserHostName-->" + userip + "<br>");

            string userContentType = Request.ContentType;
            sbuf.AppendLine("ContentType-->" + userContentType + "<br>");
            int userContentLength = Request.ContentLength;
            sbuf.AppendLine("ContentLength-->" + userContentLength.ToString() + "<br>");

            sbuf.AppendLine(string.Format("{0}_{1}", "IsAuthenticated", this.Request.IsAuthenticated.ToString() + "<br>"));
            sbuf.AppendLine(string.Format("{0}_{1}", "IsAuthenticated", this.Request.LogonUserIdentity.ToString() + "<br>"));
            Response.Write(sbuf.ToString());

            sbuf.AppendLine(string.Format("{0}_{1}", "UrlReferrer.AbsoluteUri", Request.UrlReferrer.AbsoluteUri + "<br>"));
           

            int loop1, loop2;
            NameValueCollection coll;

            // Load Header collection into NameValueCollection object.
            coll = Request.Headers;

            // Put the names of all keys into a string array.
            String[] arr1 = coll.AllKeys;
            for (loop1 = 0; loop1 < arr1.Length; loop1++)
            {
                Response.Write("Key: " + arr1[loop1] + "<br>");
                // Get all values under this key.
                String[] arr2 = coll.GetValues(arr1[loop1]);
                for (loop2 = 0; loop2 < arr2.Length; loop2++)
                {
                    Response.Write("Value " + loop2 + ": " + Server.HtmlEncode(arr2[loop2]) + "<br>");
                }
            }
   

        }
    }
}